Page({
  data:{
    res:[],
    id:'',
    placelist:wx.getStorageSync('placelist'),
    itemlist:wx.getStorageSync('itemlist'),
    imagelist:[]
  },
  todetail(e){
    console.log(e)
    var id=e.currentTarget.dataset.index
    wx.navigateTo({
      url: '../placedetail/placedetail?id='+id,
    })
  },
  onLoad(e){
    var id=e.id
    console.log(id)
    this.setData({
      id,
    })
    wx.cloud.callFunction({
      name:'gettjbyid',
      data:{
        id,
      }
      
    }).then(res=>{
      console.log(res)
      this.setData({
        res:res.result.data
      })
      res.result.data.placelist.forEach(element => {
        var imglist=this.data.imagelist
        var test=this.data.itemlist[element]
        imglist.push(test.images[0])
        this.setData({
          imglist,
        })
      });
    })
  },onSubmit(){
    wx.navigateTo({
      url: '../tjpay/tjpay?id='+this.data.id,
    })
  }
})